<template>
  <el-card>
    <el-card>
      <div slot="header" class="clearfix">
        <span>学员管理</span>
        <el-button style="float: right; padding: 3px 0" type="text"
          >添加学员</el-button
        >
      </div>
      <el-table border="" stripe :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="ID" align="center">
        </el-table-column>
        <el-table-column prop="name" label="姓名" align="center">
        </el-table-column>
        <el-table-column prop="age" label="年龄" align="center">
        </el-table-column>
        <el-table-column prop="sex" label="性别" align="center">
        </el-table-column>
        <el-table-column prop="group" label="组号" align="center">
        </el-table-column>
        <el-table-column prop="phone" label="电话" align="center" width="120px">
        </el-table-column>
        <el-table-column prop="salary" label="期望薪资" align="center">6
        </el-table-column>
        <el-table-column prop="truesalary" label="实际薪资" align="center">
        </el-table-column>
        <el-table-column
          prop="detailPlace"
          label="籍贯"
          align="center"
          width="260px"
        >
        </el-table-column>
        <el-table-column label="操作" width="150" align="center">
          <template slot-scope="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </el-card>
</template>

<script>
import { getAllStudentAPI } from "@/api/score";
export default {
  data() {
    return {
      tableData: [],
    };
  },
  async created() {
    const { data } = await getAllStudentAPI();
    data.data.map(
      (item) => (item.detailPlace = item.province + item.city + item.county)
    );
    console.log(data.data);
    this.tableData = data.data;
    // console.log(this.tableData);
  },
  methods: {
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
  },
};
</script>
